package com.terrynoya.fight.stateMachine.controllers
{
	import com.terrynoya.fight.char.Character;
	import com.terrynoya.fight.char.Entity;
	import com.terrynoya.fight.stateMachine.StateController;
	import com.terrynoya.fight.stateMachine.StateMachine;
	
	public class PosSet extends StateController
	{
		private var _x:Number;
		private var _y:Number;
		
		public function PosSet(name:String)
		{
			super(name);
		}
		
		public function get x():Number
		{
			return _x;
		}

		public function set x(value:Number):void
		{
			_x = value;
		}

		public function get y():Number
		{
			return _y;
		}

		public function set y(value:Number):void
		{
			_y = value;
		}

		override public function run(character:Character):void
		{
			if(this.hasExpression("x"))
			{
				this._x = this.excuteExpression("x",character);
				character.position.x = this.x;
			}
			if(this.hasExpression("y"))
			{
				this._y = this.excuteExpression("y",character);
				character.position.y = this.y;
			}
		}
	}
}